﻿@using MudBlazor.Utilities
@using System;
@using System.IO;
@using System.Linq;
@using System.Text.RegularExpressions;
@using System.Threading.Tasks;
@using Microsoft.AspNetCore.Components;

<MudCard>
	@if (!string.IsNullOrEmpty(Title))
	{
		<MudCardHeader>
			<CardHeaderContent>
				<MudText Typo="Typo.h6">@Title</MudText>
			</CardHeaderContent>
			@*<CardHeaderActions>
		<MudIconButton Icon="@Icons.Material.Filled.Settings" Color="Color.Default" />
		</CardHeaderActions>*@
		</MudCardHeader>
		<MudDivider DividerType="DividerType.FullWidth" />
	}
	<MudCardContent Class="@Classname">
		@if (Codes != null || ChildContent != null)
		{
			@* @if (Codes != null || ChildContent != null)
		{
		<MudToolBar Class="@ToolbarClassname">
		@if(Codes != null)
		{
		@foreach (var codefile in Codes)
		{
		<MudButton Class="@GetActiveCode(codefile.code)" OnClick="@(() => SetActiveCode(codefile.code))" Size="Size.Small">@codefile.title</MudButton>
		}
		}
		<MudSpacer/>
		@if (_hasCode && ChildContent != null)
		{
		<MudTooltip Text="Online Playground" Arrow="true" Color="Color.Dark" Placement="Placement.Top" Delay="300" Duration="500" ShowOnFocus="false">
		<MudButton OnClick="RunOnTryMudBlazor" StartIcon="@Icons.Rounded.PlayArrow" IconColor="Color.Success" Color="Color.Default" Size="Size.Small">Run</MudButton>
		</MudTooltip>
		<MudButton OnClick="OnShowCode" StartIcon="@(ShowCode ? @Icons.Rounded.CodeOff : Icons.Rounded.Code)" Color="Color.Default" Size="Size.Small">
		@(ShowCode ? "Hide code" : "Show code")
		</MudButton>
		}
		</MudToolBar>
		}*@
			@if (ChildContent != null)
			{
				@*<div class="@InnerClassname">*@
				@ChildContent
				@*	</div>*@
			}
		}
	</MudCardContent>
	@if (_hasCode)
	{
		<MudDivider DividerType="DividerType.FullWidth" />
	}
	<MudCardActions>
		@if (_hasCode)
		{
			<div class="@SourceClassname">
				@*<div class="docs-section-source-container">*@
				@CodeComponent(_activeCode)
				@*</div>*@
				@*<MudIconButton Icon="@Icons.Material.Outlined.FileCopy" Size="Size.Small" Class="copy-code-button" @onclick="CopyTextToClipboard" />*@
			</div>
		}
	</MudCardActions>
</MudCard>
